using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using LPrisaMVC.Entities;

namespace LPrisaMVC.DAO.Mapping
{
    public class DETALLEPAGOMap : EntityTypeConfiguration<DETALLEPAGO>
    {
        public DETALLEPAGOMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Descripcion)
                .IsRequired()
                .HasMaxLength(50);

            // Table & Column Mappings
            this.ToTable("DETALLEPAGO");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Descripcion).HasColumnName("Descripcion");
            this.Property(t => t.Fecha).HasColumnName("Fecha");
            this.Property(t => t.Monto).HasColumnName("Monto");
            this.Property(t => t.CreditoId).HasColumnName("CreditoId");

            // Relationships
            this.HasRequired(t => t.CREDITO)
                .WithMany(t => t.DETALLEPAGOes)
                .HasForeignKey(d => d.CreditoId);

        }
    }
}
